package map.utils.overlayutil;

import android.os.Bundle;

import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.Marker;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.map.Polyline;
import com.baidu.mapapi.map.PolylineOptions;
import com.baidu.mapapi.model.LatLng;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @author ：zhong.jw
 * @date ：Created in 2022/12/12 9:52
 */
public class LoverPoiOverlay extends OverlayManager {


    private LatLng lover = new LatLng(0.0, 0.0);
    private LatLng self = new LatLng(0.0, 0.0);

    /**
     * 通过一个BaiduMap 对象构造
     *
     * @param baiduMap
     */
    public LoverPoiOverlay(BaiduMap baiduMap) {
        super(baiduMap);
    }

    public void bindLover(LatLng self, LatLng lover) {
        this.lover = lover;
        this.self = self;
    }


    @Override
    public List<OverlayOptions> getOverlayOptions() {

        List<OverlayOptions> list = new ArrayList<>();

        MarkerOptions marker = new MarkerOptions();

        Bundle bundle = new Bundle();
        bundle.putInt("index", 0);


        marker.icon(BitmapDescriptorFactory.fromAsset("overlay/icon_mark_lover.png"))
                .extraInfo(bundle)
                .position(lover);

        list.add(marker);


//        PolylineOptions line = new PolylineOptions()
//                .points(Arrays.asList(self, lover));
//
//        list.add(line);

        return list;
    }

    @Override
    public boolean onMarkerClick(Marker marker) {
        return false;
    }

    @Override
    public boolean onPolylineClick(Polyline polyline) {
        return false;
    }
}
